// src/views/App.vue
<template>
  <el-container style="height: 100vh;">
    <el-aside width="200px" style="background-color: rgb(238, 241, 246)">
      <el-menu :default-openeds="['1']">
        <el-submenu index="1">
          <template slot="title"><i class="el-icon-menu"></i>停车场管理</template>
          <el-menu-item-group>
            <template slot="title">管理选项</template>
            <el-menu-item index="1-1" @click="goTo('/vehicles')">车辆管理</el-menu-item>
            <el-menu-item index="1-2" @click="goTo('/owners')">车主管理</el-menu-item>
            <el-menu-item index="1-3" @click="goTo('/parking-spots')">车位管理</el-menu-item>
            <el-menu-item index="1-4" @click="goTo('/parking-records')">停车记录</el-menu-item>
          </el-menu-item-group>
        </el-submenu>
      </el-menu>
    </el-aside>

    <el-container>
      <el-header style="text-align: right; background-color: #B3C0D1; color: #333; line-height: 60px;">
        <el-dropdown>
          <span class="el-dropdown-link">
            王小虎<i class="el-icon-arrow-down el-icon--right"></i>
          </span>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item @click="openUserEditDialog">编辑个人信息</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </el-header>

      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>

    <!-- User Edit Dialog Component -->
    <user-edit-dialog ref="userEditDialog"></user-edit-dialog>
  </el-container>
</template>

<script>
import UserEditDialog from './components/UserEditDialog.vue';

export default {
  components: {
    UserEditDialog
  },
  methods: {
    goTo(route) {
      this.$router.push(route);
    },
    openUserEditDialog() {
      this.$refs.userEditDialog.visible = true; // 确保 UserEditDialog.vue 有 visible 数据属性或通过 prop 接收
    }
  }
};
</script>

<style>
/* 全局样式可以放在这里 */
</style>
